package com.atguigu.dga.meta.mapper;

import com.atguigu.dga.meta.bean.TableMetaInfo;
import com.atguigu.dga.meta.bean.TableMetaInfoVO;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 元数据表 Mapper 接口
 * </p>
 *
 * @author tubage
 * @since 2024-03-15
 */
@Mapper
@DS("dga")
public interface TableMetaInfoMapper extends BaseMapper<TableMetaInfo> {
    // 考评获取所有待考评表
    @Select("SELECT \n" +
            "ti.* , te.* , ti.id AS ti_id , te.id AS te_id \n" +
            "FROM table_meta_info ti \n" +
            "JOIN  table_meta_info_extra te \n" +
            "ON  ti.schema_name = te.schema_name AND ti.table_name = te.table_name \n" +
            "WHERE ti.assess_date = #{assessDate}  ")
    @ResultMap("table_meta_info_mapper")
    List<TableMetaInfo> selectAllTableMetaInfos(String assessDate);
    // 查总数
    @Select("${sql}")
    Long selectTableMetaInfoCount(String sql);
    // 查列表
    @Select("${sql}")
    List<TableMetaInfoVO> selectTableMetaInfoVoList(String sql ) ;

}
